package com.seuic.hnapps.posdsdk.pos_func;

import android.os.Bundle;

/**
 * The POS SDK Callbacks
 */
public interface PosCallbacks {

    /**
     * The enter pin process callbacks
     */
    interface EnterPinCallbacks {
        /**
         * Enter pin process finished successfully
         *
         * @param enc The encrypted pin
         * @param is_no_pin whether the custom has not enter pin and just press OK
         */
        void onSuccess(String enc, boolean is_no_pin);

        /**
         * Enter pin process failed
         *
         * @param error The error description
         */
        void onFail(String error);

        /**
         * The key pressed event
         * will not called in terminals with touchscreen only (not equiped with a pinpad)
         *
         * @param input_num Current number of pins already entered
         *                  used to dislay an animation like ******
         */
        void onInput(int input_num);
    }

    /**
     * The read card process callbacks
     */
    interface ReadCardCallbacks {
        /**
         * The IC card insert event
         */
        void onICCardIn();

        /**
         * The RF card present event
         */
        void onRFCardIn();

        /**
         * The magnetic stripe card swipe event
         *
         * @param data The data of magstripe card
         *             @see com.seuic.hnapps.constants.EmvConstants
         *             PAN(String), the primary account number
         *             TRACK1(String), the track1 data
         *             TRACK2(String), the track2 data
         *             TRACK3(String), the track3 data
         */
        void onMagcardIn(Bundle data);

        /**
         * The ReadCard Process Failed
         *
         * @param error The error description
         */
        void OnFailed(String error);
    }

    /**
     * The EMV transactions process callbacks
     */
    interface EmvTransStartCallbacks {
        /**
         * The card detected event
         * Will be called when a IC card Inserted or a RF card present in the field
         *
         * @param type Card type
         *             CARD_TYPE_IC for IC card
         *             CARD_TYPE_ICCL for RF card
         */
        void onDetectCard(String type);

        /**
         * Let the custom to confirm card information
         * After the custom confirmed, use emvConfirmCardInfo Method to input result and continue the EMV process
         * @see PosFuncs.emvConfirmCardInfo
         *
         * @param pan The primary account number of card
         */
        void onConfirmCardInfo(String pan);

        /**
         * Return the Online Pin result to the app
         *
         * @param enc The encrypted pin
         * @param is_no_pin whether the custom has not enter pin and just press OK
         */
        void onOlinePinEntered(String enc, boolean is_no_pin);

        /**
         * The EMV process is complete successfully
         *
         * @param data The process result data bundle
         *             @see com.seuic.hnapps.constants.EmvConstants
         *             CHANNEL(String), the channel used in transaction
         *                      CHANNEL_MAGCARD, magcard used
         *                      CHANNEL_ICC, IC card used
         *                      CHANNEL_ICCL, RF card used
         *             TRACK1(String), the track1 data, only will present when the channel is magcard and the card support track1
         *             TRACK2(String), the track2 data, only will present when the channel is magcard and the card support track2
         *             TRACK3(String), the track3 data, only will present when the channel is magcard and the card support track3
         *             AC_TYPE(String), the AC type generated by emv cards, only will present when the channel is IC card or RF card
         *                  AC_TYPE_TC, the result is offline approve
         *                  AC_TYPE_ARQC, the result is request online
         *                  AC_TYPE_AAC, the result is offline reject
         *             FEILD_55(String), the field55 TLV datas of emv cards, only will present when the channel is IC card or RF card
         */
        void onSuccess(Bundle data);

        /**
         * The EMV process failed
         *
         * @param error The error description
         */
        void onFailed(String error);
    }

    /**
     * The EMV input online result callback
     */
    interface EmvOnlineResultCallbacks {
        /**
         * The card authenticate server process finished successfully
         *
         * @param data The result data bundle
         *             @see com.seuic.constants.EmvConstants
         *             AC_TYPE(String), the AC type generated by emv cards
         *                  AC_TYPE_TC, the result is approve
         *                  AC_TYPE_AAC, the result is reject
         *             FEILD_55(String), the field55 TLV datas of emv cards
         *             SCRIPT_RESULT(String), the script execute result, can be null when no script in issuer data
         *
         */
        void onSuccess(Bundle data);

        /**
         * The input online result failed
         *
         * @param error The error description
         */
        void onFailed(String error);
    }

    /**
     * The print process result callback
     */
    interface PrintCallbacaks {
        /**
         * The print complete successfully
         */
        void onSuccess();

        /**
         * The print process failed
         *
         * @param error The error description
         */
        void onFailed(String error);
    }
}
